#include <iostream>
using namespace std;
#include <string>
#include <stdio.h>

int unval; // 未初始化代码
int val = 100; // 初始化代码
int main()
{
  printf("init address: %p\n",&val); // 初始化数据地址
  printf("uninit address:%p\n",&unval); // 未初始化数据地址
  string s1 = "hello world"; // str是指针  指向字符串
  printf ("code address: %p\n",main); // 函数名就是函数地址
  printf("read only address: %p\n",s1.c_str()); // 只读常量区
  int* p = new int(10);
  int* p2 = new int(20);
  printf("heap address1: %p\n", p); // 堆区的地址
  printf("heap address2: %p\n", p2); // 堆区地址2
  printf("stack address1: %p\n", &p); // 栈区地址1
  printf("stack address2: %p\n", &p2); // 栈区地址2


  return 0;
}
